<?php
class Serverdata extends Model{
	public function getserverinfo(){
		$this->helper('number');//调用公有函数
		$server['serverinfo'] = PHP_OS.' / PHP v'.PHP_VERSION;
		$server['serverinfo'] .= @ini_get('safe_mode') ? ' Safe Mode' : NULL;
		$server['mysqlversion'] = $this->db->getversion();
		$server['fileupload'] = ini_get('upload_max_filesize');
		$dbsize = 0;
		$tables = $this->db->getAll("SHOW TABLE STATUS LIKE '".$this->db->prefix."%'");
		foreach($tables as $table) {
			$dbsize += $table['Data_length'] + $table['Index_length'];
		}
		$server['dbsize'] = $dbsize ? byte_format($dbsize) : 'UnKnown';
		$server['magic_quote_gpc'] = get_magic_quotes_gpc() ? 'On' : 'Off';
		$server['server_port'] = $_SERVER['SERVER_PORT'];
		return $server;
	}
}